<template>
  <a-config-provider :theme="{
    token: {
      colorPrimary: data.colorPrimary,
      borderRadius: `${data.borderRadius}px`,
    },
  }" :locale="zh_CN">
    <NuxtLayout> </NuxtLayout>
  </a-config-provider>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { theme } from "ant-design-vue";
import { useUserStore } from "@/store/user";
import zh_CN from "ant-design-vue/es/locale/zh_CN";

import { useNuxtApp } from '#imports';

const nuxtApp = useNuxtApp();

nuxtApp.hook('app:mounted', () => {
  console.log('App initialized');
  // 在这里调用你的初始化函数
});

onMounted(() => {
  // 每次重新挂载时，获取用户信息
  user.setUser();
})

const user = useUserStore();
const defaultData = {
  borderRadius: 6, // 统一圆角控制
  colorPrimary: "#1677ff", // 主题色控制
};
const data = ref(defaultData);
const { token } = theme.useToken();

console.log("程序挂载");
</script>

<style scoped>
input[type="color"] {
  border: 1px solid v-bind("token.colorBorder");
  background-color: v-bind("token.colorBgBase");
}
</style>